package edu.hawaii.duedates;

import edu.hawaii.duedates.library.HawaiiState;
import edu.hawaii.duedates.library.UhManoa;

/**
 * Due Dates used to find out info on library books.
 * 
 * @author John Zhou
 * @author John Ly
 */
public final class DueDates {

  /**
   * The main class logs in and retrieves info.
   * 
   * @param args Four strings: uhID, uhLastName, hiStateId, hiStatePassword.
   * @throws Exception If problems occur accessing the library sites.
   */
  public static void main(String[] args) throws Exception {
    // Check UH Manoa Library
    if (args[0].equals("UH")) {
      UhManoa uhLibrary = new UhManoa();
      String uhId = args[1];
      String uhLastName = args[2];
      System.out.printf("Getting data from UH Manoa%n");
      String uhInfo = uhLibrary.getInfo(uhId, uhLastName);
      System.out.printf("Results for UH Manoa:%n%s%n", uhInfo);
    }

    // Check the Hawaii State Library.
    if (args[0].equals("HSL")) {
      HawaiiState hiLibrary = new HawaiiState();
      String hiStateId = args[1];
      String hiStatePassword = args[2];
      System.out.printf("Getting data from Hawaii State Library System (this can take 1 minute)%n");
      String hiInfo = hiLibrary.getInfo(hiStateId, hiStatePassword);
      System.out.printf("Results for Hawaii State Library:%n %s%n", hiInfo);
    }
  }

  /**
   * Placed only to avoid Singleton error in PMD.
   * 
   */
  private DueDates() {
  }
}
